package cn.funnyxb.tools.appFrame.database;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import cn.funnyxb.tools.appFrame.App;
import cn.funnyxb.tools.appFrame.debugTool.Debuger;

public class DBService extends SQLiteOpenHelper
{
  protected OnDBCreateListener onDBCreateListener = null;

  public DBService(Context paramContext, String paramString, SQLiteDatabase.CursorFactory paramCursorFactory, int paramInt, OnDBCreateListener paramOnDBCreateListener)
  {
    super(paramContext, paramString, paramCursorFactory, paramInt);
    log("constructor,onDBCreateListener=" + paramOnDBCreateListener);
    this.onDBCreateListener = paramOnDBCreateListener;
  }

  private void log(String paramString)
  {
    Debuger.log("dbservice", paramString);
  }

  public void close()
  {
    super.close();
  }

  public void execSql(String paramString)
  {
    synchronized (App.getApp())
    {
      SQLiteDatabase localSQLiteDatabase = getWritableDatabase();
      localSQLiteDatabase.execSQL(paramString);
      localSQLiteDatabase.close();
      return;
    }
  }

  public void execSql(String paramString, Object[] paramArrayOfObject)
  {
    synchronized (App.getApp())
    {
      SQLiteDatabase localSQLiteDatabase = getWritableDatabase();
      localSQLiteDatabase.execSQL(paramString, paramArrayOfObject);
      localSQLiteDatabase.close();
      return;
    }
  }

  public void onCreate(SQLiteDatabase paramSQLiteDatabase)
  {
    log("onCreate");
    if (this.onDBCreateListener == null)
      return;
    this.onDBCreateListener.onDBCreate(paramSQLiteDatabase);
  }

  public void onUpgrade(SQLiteDatabase paramSQLiteDatabase, int paramInt1, int paramInt2)
  {
  }

  public Cursor query(String paramString, String[] paramArrayOfString)
  {
    synchronized (App.getApp())
    {
      SQLiteDatabase localSQLiteDatabase = getReadableDatabase();
      Cursor localCursor = localSQLiteDatabase.rawQuery(paramString, paramArrayOfString);
      log("before db close,cursor=" + localCursor);
      if (localCursor != null)
        localCursor.isBeforeFirst();
      localSQLiteDatabase.close();
      return localCursor;
    }
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.tools.appFrame.database.DBService
 * JD-Core Version:    0.5.3
 */